<include file="Layout/header" />
<body>

 					<div class="breadcrumbs" id="breadcrumbs">
					<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="/index.php/index/welcome">首页</a>
							</li>
							<li class="active">赛事管理</li>
						</ul>
</div>
<div class="page-content">
 <div class="row">
 <ul class="nav nav-tabs" id="myTab" style="margin-bottom: 5px;border: none;">

           <li>
           <a class="btn <?php if($_GET['stype']=='ft'||$_GET['stype']=''){?>btn-primary<?php }else{?>btn-info<?php }?>" href="/index.php/sport/match/stype/ft">足球</a>
           </li>

           <li>
           <a class="btn <?php if($_GET['stype']=='bb'){?>btn-primary<?php }else{?>btn-info<?php }?>" href="/index.php/sport/match/stype/bb">篮球</a>
           </li>
      </ul>
<ul id="myTab" class="nav nav-tabs">
  <li class="active"> <a href="#home" data-toggle="tab">赛事列表</a></li>
  <li> <a href="javascript:;" onclick="add()">添加赛事</a></li>
</ul>

 <form action="{:U('Admin/Nav/order')}" method="post">
  <div id="myTabContent" class="table-responsive">
    <div class="dataTables_wrapper" id="home">
      <table class="table table-striped table-bordered table-hover dataTable">
        <tr role="row">
          <th width="5%">排序</th>
          <th>赛事名称</th>
          <th>状态</th>
          <th>操作</th>
        </tr>
        <foreach name="data" item="v">
          <tr>
            <td><input class="form-control" style="width:40px;height:25px;" type="text" name="{$v['id']}" value="{$v['sort']}"></td>
            <td>{$v['match_name']}</td>
            <td><?php if($v['is_show']==1){?>显示<?php }else{?>隐藏<?php }?></td>
            <td> <a href="javascript:;" navId="{$v['id']}" navName="{$v['match_name']}" Stype="{$v['stype']}" is_show="{$v['is_show']}" onclick="edit(this)">修改</a> </td>
          </tr>
        </foreach>
        <tr>
          <th> <input class="btn btn-success" type="submit" value="排序"></th>
          <td></td>
          <td></td>
        </tr>
      </table>
    </div>
  </div>
</form>
</div>
 </div>
 

<div class="modal fade" id="nav-add" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;</button>
        <h4 class="modal-title" id="myModalLabel"> 添加赛事</h4>
      </div>
      <div class="modal-body">
        <form id="bjy-form" class="form-inline" action="{:U('Admin/Sport/match_add')}" method="post">
         
          <table class="table table-striped table-bordered table-hover table-condensed">
            <tr>
              <th width="18%">赛事名：</th>
              <td><input class="form-control" type="text" name="match_name"></td>
            </tr>
            <tr>
              <th>类别：</th>
              <td>
			  
			  <select name="stype"class="form-control">
			  <option value="ft">足球</option>
			  <option value="bb">篮球</option>
			  </select>
                </td>
            </tr>
            
            <tr>
              <th></th>
              <td><input class="btn btn-success" type="submit" value="添加"></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
  </div>
</div>
<div class="modal fade" id="bjy-edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> &times;</button>
        <h4 class="modal-title" id="myModalLabel"> 编辑赛事</h4>
      </div>
      <div class="modal-body">
        <form id="bjy-form" class="form-inline" action="{:U('Admin/Sport/match_edit')}" method="post">
          <input type="hidden" name="id">
          <table class="table table-striped table-bordered table-hover table-condensed">
            <tr>
              <th width="18%">赛事名：</th>
              <td><input class="form-control" type="text" name="match_name"></td>
            </tr>
             <tr>
              <th>状态：</th>
              <td>
        
        <select name="is_show"class="form-control">
        <option value="1">显示</option>
        <option value="0">隐藏</option>
        </select>
                </td>
            </tr>
             <tr>
              <th>类别：</th>
              <td>
			  
			  <select name="stype"class="form-control">
			  <option value="ft">足球</option>
			  <option value="bb">篮球</option>
			  </select>
                </td>
            </tr>
            <tr>
              <th></th>
              <td><input class="btn btn-success" type="submit" value="修改"></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
  </div>
</div> 
 <include file="Layout/js"/>
<script>
// 添加赛事
function add(){
	$("input[name='name'],input[name='mca']").val('');
	$("input[name='pid']").val(0);
	$('#nav-add').modal('show');
}



// 修改赛事
function edit(obj){
	var navId=$(obj).attr('navId');
	var navName=$(obj).attr('navName');
	
	var stype=$(obj).attr('Stype');
  var is_show=$(obj).attr('is_show');
	$("input[name='id']").val(navId);
	$("input[name='match_name']").val(navName);
	$("select[name='stype']").val(stype);
	$("select[name='is_show']").val(is_show);

	$('#bjy-edit').modal('show');
}

</script>
</body>
</html>